// Copyright (C) joyinter
// All rights reserved.
// 
// Author : Jiang Li
// Date   : 2004-6-23

#ifndef __BUTTON_H_COMMON_UI__
#define __BUTTON_H_COMMON_UI__

#pragma once

#include "wnd.h"

class CJoyToolTip;
//##ModelId=44CF17B90243
class CJoyButton :
    public CJoyCtrl
{
public:
	//##ModelId=44CF17B902D1
    typedef void (CJoyWnd::*PClickEvent)(CJoyButton*);
protected:
	//##ModelId=44CF17B902DE
    enum BUTTON_STATE
    {
		//##ModelId=44CF17B902E0
        BTN_NORMAL,
		//##ModelId=44CF17B902E1
        BTN_HOVER,
		//##ModelId=44CF17B902EE
        BTN_DOWN,
		//##ModelId=44CF17B902EF
        BTN_DISABLE
    };

	//##ModelId=44CF17B90253
    BUTTON_STATE    m_state;
	//##ModelId=44CF17B90258
    CJoyImagePtr    m_image;

	//##ModelId=44CF17B90262
    CJoyWnd*    m_pEventCtrl;
	//##ModelId=44CF17B90267
    PClickEvent m_pOnClick;

	//##ModelId=44CF17B9026B
    UINT    m_hoverTime;
	//##ModelId=44CF17B90271
    UINT    m_tipDelay;

	//##ModelId=44CF17B90272
    virtual void CM_LoadSkin(CJoyXmlElement* pSkinElem);

	//##ModelId=44CF17B90275
    virtual void CM_MouseLeave();
	//##ModelId=44CF17B90277
    virtual void CM_MouseHover();
	//##ModelId=44CF17B90281
    virtual void CM_Mouse(MouseMessage msg, const CPoint& pt);
	//##ModelId=44CF17B90285
    virtual void CM_Draw(Graphics& graph);
	//##ModelId=44CF17B90290
    virtual void CM_Enabled(bool e);
public:
	//##ModelId=44CF17B90293
    bool m_checkedBtn;
	//##ModelId=44CF17B90294
    bool m_invertX;
	//##ModelId=44CF17B90295
    bool m_invertY;    
	//##ModelId=44CF17B902A0
    REAL m_rotate;
	//##ModelId=44CF17B902A5
    CJoyToolTip*    m_toolTip;
	//##ModelId=44CF17B902A9
    CString m_tipText;
public:
	//##ModelId=44CF17B902AF
    CJoyButton(void);
	//##ModelId=44CF17B902B1
    virtual ~CJoyButton(void);

	//##ModelId=44CF17B902B4
    void SetClickEvent(CJoyWnd* pCtrl, PClickEvent pOnClick);
	//##ModelId=44CF17B902BF
    void SetImage(PCTSTR pszImage);
	//##ModelId=44CF17B902C1
    void Click();
	//##ModelId=44CF17B902C2
    void ArcClip();
	//##ModelId=44CF17B902C3
    void LeftArcClip();
	//##ModelId=44CF17B902CE
    void RightArcClip();
	//##ModelId=44CF17B902CF
    void FitImage();
	//##ModelId=44CF17B902D0
    void ClearState()
    {
        m_state = BTN_NORMAL;
    }
};

#endif  // __BUTTON_H_COMMON_UI__
